/**************************************************************************
* Copyright (c) 2015-2024 CrazyGeeker@163.com
*
* Author: CrazyGeeker@163.com  QQ: 453867443
*         https://gitee.com/crazy-geeker
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
* GNU General Public License for more details.
*
*****************************************************************************
*/

#ifndef QTERMINALWIDGET_H
#define QTERMINALWIDGET_H

#include <QWidget>
#include <Windows.h>

class QTerminalWidget : public QWidget
{
    Q_OBJECT

public:
    explicit QTerminalWidget(const QString& command, const QString& currentDir = "", QWidget* parent = nullptr);
    ~QTerminalWidget();

    void resizeEvent(QResizeEvent *event) override;

private:
    bool start(const QString& command, const QString& currentDir);

private:
    HWND m_hCmdWnd;
    HANDLE m_hCmdProcess;
    QString m_command;
};

#endif // QTERMINALWIDGET_H
